Repository navigation
Use native FSEvents for file watching on macOS - #8994
isaacroldan wants to merge 2 commits into
Conversation
|
/snapit |
|
/snapit |
|
🫰✨ Thanks @isaacroldan! Your snapshot has been published to npm. Built from Test the snapshot by installing your package globally: pnpm i -g --@shopify:registry=https://registry.npmjs.org @shopify/cli@0.0.0-snapshot-20261023095653Caution After installing, validate the version by running |
| "global-agent": "3.0.0" | ||
| }, | ||
| "optionalDependencies": { | ||
| "fsevents": "2.3.3" |
There was a problem hiding this comment.
[P2] Preserve the polling override on macOS
Could we honor CHOKIDAR_USEPOLLING=true (and =1) when enabling FSEvents? With Chokidar 3.6.0, adding fsevents leaves useFsEvents: true despite that override, so the watcher still uses the native backend. I verified the published snapshots: 0.0.0-snapshot-20261023095012 selects polling, while 0.0.0-snapshot-20261023095653 selects FSEvents with the same override.
Users who rely on polling for network-mounted projects could miss source updates in app dev or theme dev. Please translate the override into an explicit watcher option at the app and theme watcher creation sites, and add regression coverage for the selected backend.
Co-authored-by: River <river@shopify.com>
7f31b8a to
bb48019
Compare
WHY are these changes introduced?
Stacked on #8993.
The release bundle needs the optional
fseventsmodule at runtime to use native file watching on macOS. Without it, Chokidar 3 defaults to polling, increasing CPU use duringapp devandtheme dev.WHAT is this pull request doing?
Ship
fsevents@2.3.3as an optional runtime dependency and keep it external to the bundle. Its macOS platform restriction lets other platforms skip installation.Apply
CHOKIDAR_USEPOLLINGas an explicit option before Chokidar selects the backend in app, theme, and theme-extension watchers. This preserves polling overrides when FSEvents is available and keeps the default backend when the override is unset or disabled.Validation: 133 tests in the affected watcher test files, app/theme type checks, the CLI bundle build, and changed-file lint passed. Backend tests use the real Chokidar constructor with FSEvents available on macOS; the 12 polling-override cases failed before the fix. Native Linux and Windows checks were not run locally.
How to manually test your changes?
shopify app devorshopify theme devfor a local project. Create, edit, and delete a source file; confirm that changes are detected and check idle CPU use.CHOKIDAR_USEPOLLING=true shopify app devandCHOKIDAR_USEPOLLING=1 shopify theme dev. Confirm that file changes are detected, including in a network-mounted project where native events are unavailable.--omit=optional. Confirm that the CLI starts and file changes are still detected through polling.Checklist
patchfor bug fixes ·minorfor new features ·majorfor breaking changes) and added a changeset withpnpm changeset add